export const handleList = {
	methods:{
		handleList(obj) {
			if (Object.keys(obj) !== 0) {
				let bigList = []			
				for (let k in obj) {					
					obj[k].formDataList.forEach(i => {
						let obj1 = {}
						let obj2 = {}
						let arr = []
						let formInfoBigId
						for (let x in i) {
							obj[k].fieldLists.forEach((item,index) => {
								if (item.fieldName === x) {
									arr.push({
										name: item.name,
										value: i[x],
										index: index
									})
								}
								formInfoBigId = item.formInfoBigId
							})
							const list = this.sortBykey(arr,'index')
							this.$set(obj2, '无', list)
						}
						const ename = obj[k].otherLists[0].relation_ename
						this.$set(obj1, 'data', obj2)
						this.$set(obj1, 'fromId', formInfoBigId)
						this.$set(obj1, 'num', i.big_id)
						this.$set(obj1, 'type', ename)
						this.$set(obj1, 'title', k)
						bigList.push(obj1)
					})					
				}
				return bigList
			}
		},
		sortBykey(ary, key) {  //数组对象排序
			  return ary.sort(function (a, b) {
			    let x = a[key]
			    let y = b[key]
			    return ((x < y) ? -1 : (x > y) ? 1 : 0)
			  })
		}
	}
}